﻿using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient.UI
{
	// Token: 0x02001707 RID: 5895
	internal class ActivityTeamTowerSingleDlg : DlgBase<ActivityTeamTowerSingleDlg, ActivityTeamTowerSingleDlgBehaviour>
	{
		// Token: 0x1700377A RID: 14202
		// (get) Token: 0x0600F32B RID: 62251 RVA: 0x003627A8 File Offset: 0x003609A8
		// (set) Token: 0x0600F32C RID: 62252 RVA: 0x003627C0 File Offset: 0x003609C0
		public bool SweepFinished
		{
			get
			{
				return this._sweep_finished;
			}
			set
			{
				this._sweep_finished = value;
			}
		}

		// Token: 0x1700377B RID: 14203
		// (get) Token: 0x0600F32D RID: 62253 RVA: 0x003627CC File Offset: 0x003609CC
		public override string fileName
		{
			get
			{
				return "Hall/TeamTowerNewDlg";
			}
		}

		// Token: 0x1700377C RID: 14204
		// (get) Token: 0x0600F32E RID: 62254 RVA: 0x003627E4 File Offset: 0x003609E4
		public override int layer
		{
			get
			{
				return 1;
			}
		}

		// Token: 0x1700377D RID: 14205
		// (get) Token: 0x0600F32F RID: 62255 RVA: 0x003627F8 File Offset: 0x003609F8
		public override bool autoload
		{
			get
			{
				return true;
			}
		}

		// Token: 0x1700377E RID: 14206
		// (get) Token: 0x0600F330 RID: 62256 RVA: 0x0036280C File Offset: 0x00360A0C
		public override bool hideMainMenu
		{
			get
			{
				return true;
			}
		}

		// Token: 0x1700377F RID: 14207
		// (get) Token: 0x0600F331 RID: 62257 RVA: 0x00362820 File Offset: 0x00360A20
		public override bool pushstack
		{
			get
			{
				return true;
			}
		}

		// Token: 0x17003780 RID: 14208
		// (get) Token: 0x0600F332 RID: 62258 RVA: 0x00362834 File Offset: 0x00360A34
		public override bool fullscreenui
		{
			get
			{
				return true;
			}
		}

		// Token: 0x17003781 RID: 14209
		// (get) Token: 0x0600F333 RID: 62259 RVA: 0x00362848 File Offset: 0x00360A48
		public override int sysid
		{
			get
			{
				return XFastEnumIntEqualityComparer<XSysDefine>.ToInt(XSysDefine.XSys_Activity_TeamTowerSingle);
			}
		}

		// Token: 0x0600F334 RID: 62260 RVA: 0x00362864 File Offset: 0x00360A64
		protected override void Init()
		{
			this._doc = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
			this._doc.TeamTowerSingleView = this;
			string value = XSingleton<XGlobalConfig>.singleton.GetValue("SweepTowerTime");
			string[] array = value.Split(new char[]
			{
				'|'
			});
			this._sweep_time = float.Parse(array[0].Split(new char[]
			{
				'='
			})[1]);
			string value2 = XSingleton<XGlobalConfig>.singleton.GetValue("RefreshSweepRand");
			string[] array2 = value2.Split(new char[]
			{
				'|'
			});
			this._random_list.Clear();
			for (int i = 0; i < array2.Length; i++)
			{
				this._random_list.Add((float)int.Parse(array2[i].Split(new char[]
				{
					'='
				})[0]) / 100f);
			}
			string value3 = XSingleton<XGlobalConfig>.singleton.GetValue("RefreshSweepCost");
			string[] array3 = value3.Split(new char[]
			{
				'|'
			});
			this._refresh_cost.Clear();
			this._refresh_money.Clear();
			for (int j = 0; j < array3.Length; j++)
			{
				string[] array4 = array3[j].Split(new char[]
				{
					'='
				});
				this._refresh_cost.Add(int.Parse(array4[1]));
				this._refresh_money.Add(int.Parse(array4[0]));
			}
			this.frames.Clear();
			string value4 = XSingleton<XGlobalConfig>.singleton.GetValue("TeamTower_Ani");
			string[] array5 = value4.Split(new char[]
			{
				'|'
			});
			for (int k = 0; k < array5.Length; k++)
			{
				this.frames.Add(int.Parse(array5[k]));
			}
			this._all_count = this.frames.Count;
		}

		// Token: 0x0600F335 RID: 62261 RVA: 0x00362A54 File Offset: 0x00360C54
		public override void RegisterEvent()
		{
			base.RegisterEvent();
			base.uiBehaviour.mMainClose.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseDlg));
			base.uiBehaviour.m_Help.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnHelpClicked));
			base.uiBehaviour.mSweepBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnShowSweepFrame));
			base.uiBehaviour.mSingleDoSweep.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnQuickStartSweep));
			base.uiBehaviour.mDoubleSweep.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnStartSweep));
			base.uiBehaviour.mDoubleDoSweep.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnQuickStartSweep));
			base.uiBehaviour.mBackClick.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseSweep));
			base.uiBehaviour.mCloseSweep.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseSweep));
			base.uiBehaviour.mResetBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnReqResetSweep));
			base.uiBehaviour.mRank.RegisterClickEventHandler(new ButtonClickEventHandler(this.ShowTeamTowerRank));
			base.uiBehaviour.mGoBattle.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnEnterBattle));
			base.uiBehaviour.mRewardRefresh.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnRefreshReward));
			base.uiBehaviour.mRewardGet.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGetReward));
			base.uiBehaviour.mFirstPassBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnShowFirstPassReward));
			base.uiBehaviour.mFirstPassGetReward.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGetFirstPassReward));
			base.uiBehaviour.mFirstPassBackClick.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnHideFirstPassReward));
			base.uiBehaviour.mFirstPassCheckReward.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGetDisableReward));
		}

		// Token: 0x0600F336 RID: 62262 RVA: 0x00362C58 File Offset: 0x00360E58
		public bool OnHelpClicked(IXUIButton button)
		{
			DlgBase<XCommonHelpTipView, XCommonHelpTipBehaviour>.singleton.ShowHelp(XSysDefine.XSys_Activity_TeamTowerSingle);
			return true;
		}

		// Token: 0x0600F337 RID: 62263 RVA: 0x00362C7B File Offset: 0x00360E7B
		protected override void OnShow()
		{
			this.ShowTeamTowerFrame();
		}

		// Token: 0x0600F338 RID: 62264 RVA: 0x00362C88 File Offset: 0x00360E88
		protected override void OnHide()
		{
			bool flag = this._count_timer > 0U;
			if (flag)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(this._count_timer);
			}
			this._count_timer = 0U;
			bool flag2 = this._show_sweep_timer > 0U;
			if (flag2)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(this._show_sweep_timer);
			}
			this._show_sweep_timer = 0U;
		}

		// Token: 0x0600F339 RID: 62265 RVA: 0x00362CE0 File Offset: 0x00360EE0
		private void ShowTeamTowerFrame()
		{
			base.uiBehaviour.mSweepFrame.SetVisible(false);
			base.uiBehaviour.mSweepResult.SetVisible(false);
			base.uiBehaviour.mFirstPassPanel.SetVisible(false);
			this._sweep_level = 0;
			this._sweep_finished = false;
			this._is_getting_reward = false;
			this._doc.GetSingleTowerActivityTop();
		}

		// Token: 0x0600F33A RID: 62266 RVA: 0x00362D48 File Offset: 0x00360F48
		private bool OnCloseDlg(IXUIButton btn)
		{
			this.SetVisibleWithAnimation(false, null);
			return true;
		}

		// Token: 0x0600F33B RID: 62267 RVA: 0x00362D64 File Offset: 0x00360F64
		private bool ShowTeamTowerRank(IXUIButton btn)
		{
			DlgBase<XRankView, XRankBehaviour>.singleton.ShowRank(XSysDefine.XSys_Rank_TeamTower);
			return true;
		}

		// Token: 0x0600F33C RID: 62268 RVA: 0x00362D88 File Offset: 0x00360F88
		public void OnRefreshTopInfo()
		{
			bool flag = this._doc == null || !base.IsVisible();
			if (!flag)
			{
				TeamTowerData singleTowerData = this._doc.SingleTowerData;
				TeamTowerRewardTable.RowData[] teamTowerTable = this._doc.GetTeamTowerTable();
				bool flag2 = singleTowerData == null;
				if (!flag2)
				{
					bool flag3 = singleTowerData.sweeplefttime > 0;
					if (flag3)
					{
						bool flag4 = (float)singleTowerData.sweeplefttime <= Time.time - singleTowerData.sweepreqtime;
						if (flag4)
						{
							this._in_sweeping = false;
							this._sweep_finished = true;
						}
						else
						{
							this._in_sweeping = true;
							this._sweep_finished = false;
						}
					}
					else
					{
						bool flag5 = singleTowerData.maxlevel == singleTowerData.sweepfloor && singleTowerData.maxlevel > 0;
						if (flag5)
						{
							this._sweep_finished = true;
						}
						else
						{
							this._sweep_finished = false;
						}
						this._in_sweeping = false;
					}
					this._sweep_level = singleTowerData.sweepfloor;
					int leftcount = this._doc.SingleTowerData.leftcount;
					int num = singleTowerData.level + 1;
					bool flag6 = num >= teamTowerTable.Length;
					if (flag6)
					{
						num = teamTowerTable.Length;
					}
					base.uiBehaviour.mStage.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_LEVEL"), num));
					int num2 = 1;
					int.TryParse(XSingleton<XGlobalConfig>.singleton.GetValue("TowerTeamDayCount"), out num2);
					base.uiBehaviour.mResetNum.SetText(string.Format("{0}/{1}", leftcount, num2));
					bool flag7 = leftcount > 0;
					if (flag7)
					{
						base.uiBehaviour.mResetSprite.SetVisible(true);
						base.uiBehaviour.mResetCount.SetText(leftcount.ToString());
					}
					else
					{
						base.uiBehaviour.mResetSprite.SetVisible(false);
					}
					this.OnInitMainReward();
					this.InitTowerMap(singleTowerData.level);
					this.OnRefreshSweepInfo();
					this.OnInitFirstReward();
					bool sweep_finished = this._sweep_finished;
					if (sweep_finished)
					{
						this.OnShowSweepResultFrame();
					}
					else
					{
						this.OnHideSweepResultFrame();
					}
				}
			}
		}

		// Token: 0x0600F33D RID: 62269 RVA: 0x00362F98 File Offset: 0x00361198
		public void OnRefreshSweepInfo()
		{
			TeamTowerData singleTowerData = this._doc.SingleTowerData;
			this._time_left = (float)singleTowerData.sweeplefttime - (Time.time - singleTowerData.sweepreqtime);
			this._in_sweeping = (this._time_left > 0f);
			bool flag = this._time_left < 0f;
			if (flag)
			{
				this._time_left = 0f;
			}
			bool flag2 = this._time_left > 0f;
			if (flag2)
			{
				this.DoCountDown(null);
			}
			bool in_sweeping = this._in_sweeping;
			if (in_sweeping)
			{
				this._show_sweep_timer = XSingleton<XTimerMgr>.singleton.SetTimer(0.5f, new XTimerMgr.ElapsedEventHandler(this.LateShowSweepFrame), null);
			}
		}

		// Token: 0x0600F33E RID: 62270 RVA: 0x00363044 File Offset: 0x00361244
		private bool HasFirstRewardRedPoint()
		{
			TeamTowerData singleTowerData = this._doc.SingleTowerData;
			TeamTowerRewardTable.RowData[] teamTowerTable = this._doc.GetTeamTowerTable();
			int num = 0;
			bool flag = singleTowerData.firstpassreward.Count > 0;
			if (flag)
			{
				num = singleTowerData.firstpassreward[singleTowerData.firstpassreward.Count - 1];
			}
			int num2 = 0;
			for (int i = singleTowerData.maxlevel - 1; i >= 0; i--)
			{
				bool flag2 = teamTowerTable[i].FirstPassReward.Count > 0 && teamTowerTable[i].preward != 0;
				if (flag2)
				{
					num2 = i + 1;
					break;
				}
			}
			return num2 > num;
		}

		// Token: 0x0600F33F RID: 62271 RVA: 0x003630F4 File Offset: 0x003612F4
		private int GetRewardLevel()
		{
			TeamTowerData singleTowerData = this._doc.SingleTowerData;
			TeamTowerRewardTable.RowData[] teamTowerTable = this._doc.GetTeamTowerTable();
			int num = 0;
			bool flag = singleTowerData.firstpassreward.Count > 0;
			if (flag)
			{
				num = singleTowerData.firstpassreward[singleTowerData.firstpassreward.Count - 1];
			}
			for (int i = num + 1; i < singleTowerData.maxlevel; i++)
			{
				bool flag2 = teamTowerTable[i].FirstPassReward.Count > 0 && teamTowerTable[i].preward > 0;
				if (flag2)
				{
					return i + 1;
				}
			}
			return singleTowerData.firstpassreward[singleTowerData.firstpassreward.Count - 1];
		}

		// Token: 0x0600F340 RID: 62272 RVA: 0x003631B0 File Offset: 0x003613B0
		private int GetNextRewardLevel()
		{
			TeamTowerData singleTowerData = this._doc.SingleTowerData;
			TeamTowerRewardTable.RowData[] teamTowerTable = this._doc.GetTeamTowerTable();
			int num = 0;
			bool flag = singleTowerData.firstpassreward.Count > 0;
			if (flag)
			{
				num = singleTowerData.firstpassreward[singleTowerData.firstpassreward.Count - 1];
			}
			for (int i = num + 1; i < teamTowerTable.Length; i++)
			{
				bool flag2 = teamTowerTable[i].FirstPassReward.Count > 0 && teamTowerTable[i].preward > 0;
				if (flag2)
				{
					return i + 1;
				}
			}
			return singleTowerData.firstpassreward[singleTowerData.firstpassreward.Count - 1];
		}

		// Token: 0x0600F341 RID: 62273 RVA: 0x0036326C File Offset: 0x0036146C
		private void OnInitFirstReward()
		{
			bool flag = this.HasFirstRewardRedPoint();
			if (flag)
			{
				base.uiBehaviour.mFirstPassRedPoint.SetVisible(true);
				base.uiBehaviour.mFirstPassLevel.SetText(string.Format(XStringDefineProxy.GetString("TEAMTOWER_LEVEL"), this.GetRewardLevel()));
			}
			else
			{
				base.uiBehaviour.mFirstPassRedPoint.SetVisible(false);
				base.uiBehaviour.mFirstPassLevel.SetText(string.Format(XStringDefineProxy.GetString("TEAMTOWER_LEVEL"), this.GetNextRewardLevel()));
			}
			bool flag2 = base.uiBehaviour.mFirstPassPanel.IsVisible();
			if (flag2)
			{
				this.OnShowFirstPassReward(null);
			}
		}

		// Token: 0x0600F342 RID: 62274 RVA: 0x00363320 File Offset: 0x00361520
		public bool OnShowFirstPassReward(IXUIButton btn)
		{
			base.uiBehaviour.mFirstPassPanel.SetVisible(true);
			TeamTowerRewardTable.RowData[] teamTowerTable = this._doc.GetTeamTowerTable();
			bool flag = this.HasFirstRewardRedPoint();
			int num;
			if (flag)
			{
				num = this.GetRewardLevel();
				base.uiBehaviour.mFirstPassGet.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
				base.uiBehaviour.mFIrstPassCheck.gameObject.transform.localPosition = new Vector3(1000f, 0f, 0f);
				base.uiBehaviour.mFirstPassCongraThrough.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_CONGRA_THROUGH"), this.GetRewardLevel()));
			}
			else
			{
				num = this.GetNextRewardLevel();
				base.uiBehaviour.mFirstPassGet.gameObject.transform.localPosition = new Vector3(1000f, 0f, 0f);
				base.uiBehaviour.mFIrstPassCheck.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
				base.uiBehaviour.mFirstPassPlsThrough.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_PLS_THROUGH"), this.GetNextRewardLevel()));
			}
			base.uiBehaviour.mFirstPassReward.ReturnAll(false);
			SeqListRef<int> firstPassReward = teamTowerTable[num - 1].FirstPassReward;
			for (int i = 0; i < firstPassReward.Count; i++)
			{
				GameObject gameObject = base.uiBehaviour.mFirstPassReward.FetchGameObject(false);
				XItem xitem = XBagDocument.MakeXItem(firstPassReward[i, 0], false);
				xitem.itemCount = firstPassReward[i, 1];
				int num2 = (i % 2 == 0) ? 1 : -1;
				int num3 = base.uiBehaviour.mFirstPassReward.TplWidth / 2;
				bool flag2 = firstPassReward.Count % 2 == 1;
				if (flag2)
				{
					num3 = 0;
				}
				XSingleton<XItemDrawerMgr>.singleton.DrawItem(gameObject.transform.Find("Item").gameObject, xitem);
				gameObject.transform.localPosition = new Vector3(base.uiBehaviour.mFirstPassReward.TplPos.x + (float)(num2 * ((i + 1) / 2) * base.uiBehaviour.mFirstPassReward.TplWidth) + (float)num3, base.uiBehaviour.mFirstPassReward.TplPos.y, base.uiBehaviour.mFirstPassReward.TplPos.z);
			}
			return true;
		}

		// Token: 0x0600F343 RID: 62275 RVA: 0x003635D5 File Offset: 0x003617D5
		private void OnHideFirstPassReward(IXUISprite sp)
		{
			base.uiBehaviour.mFirstPassPanel.SetVisible(false);
		}

		// Token: 0x0600F344 RID: 62276 RVA: 0x003635EC File Offset: 0x003617EC
		public bool OnGetFirstPassReward(IXUIButton btn)
		{
			bool is_getting_reward = this._is_getting_reward;
			bool result;
			if (is_getting_reward)
			{
				result = false;
			}
			else
			{
				this._doc.GetFirstPassReward(this.GetRewardLevel());
				this._is_getting_reward = true;
				result = true;
			}
			return result;
		}

		// Token: 0x0600F345 RID: 62277 RVA: 0x00363628 File Offset: 0x00361828
		private bool OnGetDisableReward(IXUIButton btn)
		{
			XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_CANOT_GET"), "fece00");
			return true;
		}

		// Token: 0x0600F346 RID: 62278 RVA: 0x0036365C File Offset: 0x0036185C
		public void OnGetFirstPassRewardRes(ErrorCode error)
		{
			this._is_getting_reward = false;
			bool flag = error > ErrorCode.ERR_SUCCESS;
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(error, "fece00");
			}
			else
			{
				this._doc.GetSingleTowerActivityTop();
			}
		}

		// Token: 0x0600F347 RID: 62279 RVA: 0x00363698 File Offset: 0x00361898
		public void LateShowSweepFrame(object obj)
		{
			this.OnShowSweepFrame(null);
		}

		// Token: 0x0600F348 RID: 62280 RVA: 0x003636A4 File Offset: 0x003618A4
		public bool OnShowSweepFrame(IXUIButton btn)
		{
			bool sweep_finished = this._sweep_finished;
			bool result;
			if (sweep_finished)
			{
				base.uiBehaviour.mSweepResult.SetVisible(true);
				result = true;
			}
			else
			{
				bool flag = this._doc.SingleTowerData.maxlevel == 0;
				if (flag)
				{
					XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_FIRST_NOT_SWEEP"), "fece00");
					result = false;
				}
				else
				{
					bool flag2 = this._doc.SingleTowerData.level == this._doc.SingleTowerData.maxlevel || this._sweep_finished;
					if (flag2)
					{
						XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_LAST_NOT_SWEEP"), "fece00");
						result = false;
					}
					else
					{
						TeamTowerData singleTowerData = this._doc.SingleTowerData;
						base.uiBehaviour.mSweepFrame.SetVisible(true);
						base.uiBehaviour.mSweepedLevel.SetText(string.Format(XStringDefineProxy.GetString("TEAMTOWER_REACH_LEVEL"), singleTowerData.maxlevel));
						bool in_sweeping = this._in_sweeping;
						if (in_sweeping)
						{
							base.uiBehaviour.mSingleDoSweep.SetVisible(true);
							base.uiBehaviour.mDoubleSweep.SetVisible(false);
							base.uiBehaviour.mDoubleDoSweep.SetVisible(false);
							base.uiBehaviour.mSingleMoneyNum.SetText("20");
							string itemSmallIcon = XBagDocument.GetItemSmallIcon(7, 0U);
							base.uiBehaviour.mSingleMoneySign.SetSprite(itemSmallIcon);
							this.SetTimeLeft((int)this._time_left);
						}
						else
						{
							base.uiBehaviour.mSingleDoSweep.SetVisible(false);
							base.uiBehaviour.mDoubleSweep.SetVisible(true);
							base.uiBehaviour.mDoubleDoSweep.SetVisible(true);
							base.uiBehaviour.mDoubleMoneyNum.SetText("20");
							string itemSmallIcon2 = XBagDocument.GetItemSmallIcon(7, 0U);
							base.uiBehaviour.mDoubleMoneySign.SetSprite(itemSmallIcon2);
							bool flag3 = singleTowerData.maxlevel > singleTowerData.level;
							if (flag3)
							{
								this.SetTimeLeft((int)this._sweep_time * (singleTowerData.maxlevel - singleTowerData.level));
							}
							else
							{
								this.SetTimeLeft((int)this._sweep_time * singleTowerData.maxlevel);
							}
						}
						this.OnInitReward(base.uiBehaviour.mRewardPool, 1f);
						result = true;
					}
				}
			}
			return result;
		}

		// Token: 0x0600F349 RID: 62281 RVA: 0x0036390C File Offset: 0x00361B0C
		private void SetTimeLeft(int time)
		{
			int num = time / 3600;
			int num2 = (time - num * 3600) / 60;
			int num3 = time % 60;
			string text = string.Format("{0:D2}:{1:D2}:{2:D2}", num, num2, num3);
			base.uiBehaviour.mSweepEstimateTime.SetText(text);
		}

		// Token: 0x0600F34A RID: 62282 RVA: 0x00363964 File Offset: 0x00361B64
		private void OnInitReward(XUIPool pool, float rewardalpha = 1f)
		{
			Dictionary<int, int> dictionary = new Dictionary<int, int>();
			TeamTowerRewardTable.RowData[] teamTowerTable = this._doc.GetTeamTowerTable();
			TeamTowerData singleTowerData = this._doc.SingleTowerData;
			int maxlevel = singleTowerData.maxlevel;
			int num = (maxlevel < teamTowerTable.Length) ? maxlevel : teamTowerTable.Length;
			for (int i = singleTowerData.level; i < num; i++)
			{
				TeamTowerRewardTable.RowData rowData = teamTowerTable[i];
				for (int j = 0; j < rowData.Reward.Count; j++)
				{
					bool flag = dictionary.ContainsKey(rowData.Reward[j, 0]);
					if (flag)
					{
						Dictionary<int, int> dictionary2 = dictionary;
						int key = rowData.Reward[j, 0];
						dictionary2[key] += rowData.Reward[j, 1];
					}
					else
					{
						dictionary[rowData.Reward[j, 0]] = rowData.Reward[j, 1];
					}
				}
			}
			List<int> list = new List<int>(dictionary.Keys);
			pool.ReturnAll(false);
			bool active = XActivityDocument.Doc.IsInnerDropTime(530U);
			for (int k = 0; k < list.Count; k++)
			{
				GameObject gameObject = pool.FetchGameObject(false);
				XItem xitem = XBagDocument.MakeXItem(list[k], false);
				xitem.itemCount = (int)((float)dictionary[list[k]] * rewardalpha + 0.5f);
				IXUITweenTool ixuitweenTool = gameObject.transform.Find("Item/Num").GetComponent("XUIPlayTween") as IXUITweenTool;
				bool flag2 = ixuitweenTool != null;
				if (flag2)
				{
					ixuitweenTool.ResetTweenByGroup(true, 0);
					ixuitweenTool.PlayTween(true, -1f);
				}
				int num2 = (k % 2 == 0) ? 1 : -1;
				int num3 = pool.TplWidth / 2;
				bool flag3 = list.Count % 2 == 1;
				if (flag3)
				{
					num3 = 0;
				}
				XSingleton<XItemDrawerMgr>.singleton.DrawItem(gameObject.transform.Find("Item").gameObject, xitem);
				gameObject.transform.localPosition = new Vector3(pool.TplPos.x + (float)(num2 * ((k + 1) / 2) * pool.TplWidth) + (float)num3, pool.TplPos.y, pool.TplPos.z);
				Transform transform = gameObject.transform.Find("Item/Double");
				bool flag4 = transform != null;
				if (flag4)
				{
					transform.gameObject.SetActive(active);
				}
			}
		}

		// Token: 0x0600F34B RID: 62283 RVA: 0x00363C04 File Offset: 0x00361E04
		private void OnInitMainReward()
		{
			Dictionary<int, int> dictionary = new Dictionary<int, int>();
			Dictionary<int, int> dictionary2 = new Dictionary<int, int>();
			base.uiBehaviour.mMainRewardPool.ReturnAll(false);
			TeamTowerRewardTable.RowData[] teamTowerTable = this._doc.GetTeamTowerTable();
			int num = this._doc.SingleTowerData.level;
			bool flag = num >= teamTowerTable.Length;
			if (flag)
			{
				num = teamTowerTable.Length - 1;
			}
			TeamTowerRewardTable.RowData rowData = teamTowerTable[num];
			bool flag2 = rowData.preward == 0 && num >= this._doc.SingleTowerData.maxlevel;
			if (flag2)
			{
				for (int i = 0; i < rowData.FirstPassReward.Count; i++)
				{
					bool flag3 = rowData.FirstPassReward[i, 1] > 0;
					if (flag3)
					{
						bool flag4 = dictionary2.ContainsKey(rowData.FirstPassReward[i, 0]);
						if (flag4)
						{
							Dictionary<int, int> dictionary3 = dictionary2;
							int key = rowData.FirstPassReward[i, 0];
							dictionary3[key] += rowData.FirstPassReward[i, 1];
						}
						else
						{
							dictionary2[rowData.FirstPassReward[i, 0]] = rowData.FirstPassReward[i, 1];
						}
					}
				}
			}
			for (int j = 0; j < rowData.Reward.Count; j++)
			{
				bool flag5 = rowData.Reward[j, 1] > 0;
				if (flag5)
				{
					bool flag6 = dictionary.ContainsKey(rowData.Reward[j, 0]);
					if (flag6)
					{
						Dictionary<int, int> dictionary3 = dictionary;
						int key = rowData.Reward[j, 0];
						dictionary3[key] += rowData.Reward[j, 1];
					}
					else
					{
						dictionary[rowData.Reward[j, 0]] = rowData.Reward[j, 1];
					}
				}
			}
			List<int> list = new List<int>(dictionary.Keys);
			List<int> list2 = new List<int>(dictionary2.Keys);
			int num2 = list.Count + list2.Count;
			for (int k = 0; k < list.Count; k++)
			{
				GameObject gameObject = base.uiBehaviour.mMainRewardPool.FetchGameObject(false);
				XItem xitem = XBagDocument.MakeXItem(list[k], false);
				xitem.itemCount = dictionary[list[k]];
				int num3 = base.uiBehaviour.mMainRewardPool.TplWidth / 2;
				bool flag7 = num2 % 2 == 1;
				if (flag7)
				{
					num3 = 0;
				}
				xitem.Description.ItemDrawer.DrawItem(gameObject, xitem, true);
				gameObject.transform.localPosition = new Vector3(base.uiBehaviour.mMainRewardPool.TplPos.x + (float)(k - (num2 - 1) / 2) * 1f * (float)base.uiBehaviour.mMainRewardPool.TplWidth - (float)num3, base.uiBehaviour.mMainRewardPool.TplPos.y, base.uiBehaviour.mMainRewardPool.TplPos.z);
				IXUISprite ixuisprite = gameObject.transform.Find("shoutong").GetComponent("XUISprite") as IXUISprite;
				bool flag8 = ixuisprite != null;
				if (flag8)
				{
					ixuisprite.SetVisible(false);
				}
			}
			for (int l = 0; l < list2.Count; l++)
			{
				int num4 = l + list.Count;
				GameObject gameObject2 = base.uiBehaviour.mMainRewardPool.FetchGameObject(false);
				XItem xitem2 = XBagDocument.MakeXItem(list2[l], false);
				xitem2.itemCount = dictionary2[list2[l]];
				int num5 = base.uiBehaviour.mMainRewardPool.TplWidth / 2;
				bool flag9 = (list.Count + list2.Count) % 2 == 1;
				if (flag9)
				{
					num5 = 0;
				}
				xitem2.Description.ItemDrawer.DrawItem(gameObject2, xitem2, true);
				gameObject2.transform.localPosition = new Vector3(base.uiBehaviour.mMainRewardPool.TplPos.x + (float)(num4 - (num2 - 1) / 2) * 1f * (float)base.uiBehaviour.mMainRewardPool.TplWidth - (float)num5, base.uiBehaviour.mMainRewardPool.TplPos.y, base.uiBehaviour.mMainRewardPool.TplPos.z);
				IXUISprite ixuisprite2 = gameObject2.transform.Find("shoutong").GetComponent("XUISprite") as IXUISprite;
				bool flag10 = ixuisprite2 != null;
				if (flag10)
				{
					ixuisprite2.SetVisible(true);
				}
			}
			double attr = XSingleton<XEntityMgr>.singleton.Player.PlayerAttributes.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Total);
			SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData((uint)rowData.SceneID);
			double num6 = (double)sceneData.RecommendPower * 1.0;
			bool flag11 = sceneData != null;
			if (flag11)
			{
				num6 = (double)sceneData.RecommendPower * 1.0;
			}
			double num7 = (attr - num6 * 1.0) / num6 * 1.0;
			bool flag12 = num7 > 0.01;
			if (flag12)
			{
				base.uiBehaviour.mDemandFP.SetText(num6.ToString());
				base.uiBehaviour.mDemandFP.SetColor(Color.green);
			}
			else
			{
				bool flag13 = num7 > -0.01;
				if (flag13)
				{
					base.uiBehaviour.mDemandFP.SetText(string.Format("[e2ca9e]{0}[-]", num6));
				}
				else
				{
					base.uiBehaviour.mDemandFP.SetText(num6.ToString());
					base.uiBehaviour.mDemandFP.SetColor(Color.red);
				}
			}
		}

		// Token: 0x0600F34C RID: 62284 RVA: 0x0036420C File Offset: 0x0036240C
		public bool OnCloseSweep(IXUIButton btn)
		{
			base.uiBehaviour.mSweepFrame.SetVisible(false);
			return true;
		}

		// Token: 0x0600F34D RID: 62285 RVA: 0x00364234 File Offset: 0x00362434
		public bool OnStartSweep(IXUIButton btn)
		{
			RpcC2G_SweepTower rpcC2G_SweepTower = new RpcC2G_SweepTower();
			rpcC2G_SweepTower.oArg.hardLevel = this.GetHardLevel();
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_SweepTower);
			return true;
		}

		// Token: 0x0600F34E RID: 62286 RVA: 0x0036426C File Offset: 0x0036246C
		public int GetHardLevel()
		{
			return this._doc.ExpeditionId % 100 / 10 + 1;
		}

		// Token: 0x0600F34F RID: 62287 RVA: 0x00364294 File Offset: 0x00362494
		public void OnStartSweepRes(SweepTowerArg arg, int timeleft)
		{
			bool flag = arg.cost == null || arg.cost.itemID == 0U;
			if (flag)
			{
				this._time_left = (float)timeleft;
				this._in_sweeping = true;
				this._sweep_finished = false;
				this.DoCountDown(null);
				TeamTowerData singleTowerData = this._doc.SingleTowerData;
				singleTowerData.sweepreqtime = Time.time;
				base.uiBehaviour.mSingleDoSweep.SetVisible(true);
				base.uiBehaviour.mDoubleSweep.SetVisible(false);
				base.uiBehaviour.mDoubleDoSweep.SetVisible(false);
			}
			else
			{
				this._time_left = 0f;
				this._in_sweeping = false;
				this._sweep_finished = true;
				this.OnCloseSweep(null);
				this.OnQuickStartSweepRes();
			}
		}

		// Token: 0x0600F350 RID: 62288 RVA: 0x00364358 File Offset: 0x00362558
		public bool OnQuickStartSweep(IXUIButton btn)
		{
			RpcC2G_SweepTower rpcC2G_SweepTower = new RpcC2G_SweepTower();
			rpcC2G_SweepTower.oArg.cost = new ItemBrief();
			rpcC2G_SweepTower.oArg.hardLevel = 1;
			rpcC2G_SweepTower.oArg.cost.itemID = 7U;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_SweepTower);
			return true;
		}

		// Token: 0x0600F351 RID: 62289 RVA: 0x003643B0 File Offset: 0x003625B0
		public void OnQuickStartSweepRes()
		{
			this._sweep_finished = true;
			this._in_sweeping = false;
			this._time_left = 0f;
			TeamTowerData singleTowerData = this._doc.SingleTowerData;
			bool flag = singleTowerData.level >= this._doc.GetTeamTowerTopLevel(1);
			if (flag)
			{
				this._doc.ExpeditionId = this._doc.ExpeditionId - this._doc.ExpeditionId % 10 + 1;
				int count = this._doc.GetDayCount(TeamLevelType.TeamLevelTeamTower, null) - 1;
				this._doc.OnRefreshDayCount(TeamLevelType.TeamLevelTeamTower, count);
			}
			this.OnCloseSweep(null);
			this.OnShowSweepResultFrame();
			this._doc.GetSingleTowerActivityTop();
		}

		// Token: 0x0600F352 RID: 62290 RVA: 0x00364468 File Offset: 0x00362668
		private bool OnReqResetSweep(IXUIButton btn)
		{
			bool flag = this._doc.SingleTowerData.leftcount <= 0;
			bool result;
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(ErrorCode.ERR_TEAM_TOWER_DAYCOUNT, "fece00");
				result = false;
			}
			else
			{
				bool flag2 = this._doc.SingleTowerData.level == 0;
				if (flag2)
				{
					XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_FIRST_NOT_RESET"), "fece00");
					result = false;
				}
				else
				{
					bool in_sweeping = this._in_sweeping;
					if (in_sweeping)
					{
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(true, true);
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetSingleButtonMode(true);
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetLabelsWithSymbols(XStringDefineProxy.GetString("TEAMTOWER_IN_SWEEP"), XStringDefineProxy.GetString("COMMON_OK"), XStringDefineProxy.GetString("COMMON_OK"));
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetModalCallback(new ButtonClickEventHandler(this.OnCancelReset), new ButtonClickEventHandler(this.OnCancelReset));
					}
					else
					{
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(true, true);
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetSingleButtonMode(false);
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetLabelsWithSymbols(XStringDefineProxy.GetString("TEAMTOWER_RESET_INFO"), XStringDefineProxy.GetString("TEAMTOWER_RESET"), XStringDefineProxy.GetString("COMMON_CANCEL"));
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetModalCallback(new ButtonClickEventHandler(this.OnResetSweep), new ButtonClickEventHandler(this.OnCancelReset));
					}
					result = true;
				}
			}
			return result;
		}

		// Token: 0x0600F353 RID: 62291 RVA: 0x003645CC File Offset: 0x003627CC
		private bool OnCancelReset(IXUIButton btn)
		{
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			return true;
		}

		// Token: 0x0600F354 RID: 62292 RVA: 0x003645EC File Offset: 0x003627EC
		public bool OnResetSweep(IXUIButton btn)
		{
			this._doc.ResetSingleTower();
			return true;
		}

		// Token: 0x0600F355 RID: 62293 RVA: 0x0036460C File Offset: 0x0036280C
		public void OnResetSweepRes()
		{
			TeamTowerData singleTowerData = this._doc.SingleTowerData;
			singleTowerData.sweepfloor = 1;
			singleTowerData.sweeplefttime = 0;
			this._in_sweeping = false;
			this._sweep_finished = false;
			this._doc.ExpeditionId = this._doc.ExpeditionId - this._doc.ExpeditionId % 10 + 1;
			XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAMTOWER_RESETOK"), "fece00");
			this._doc.GetSingleTowerActivityTop();
		}

		// Token: 0x0600F356 RID: 62294 RVA: 0x00364690 File Offset: 0x00362890
		public bool OnEnterBattle(IXUIButton btn)
		{
			TeamTowerRewardTable.RowData[] teamTowerTable = this._doc.GetTeamTowerTable();
			int level = this._doc.SingleTowerData.level;
			bool flag = level >= teamTowerTable.Length;
			bool result;
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAMTOWER_REACH_TOP"), "fece00");
				result = false;
			}
			else
			{
				TeamTowerRewardTable.RowData rowData = teamTowerTable[this._doc.SingleTowerData.level];
				PtcC2G_EnterSceneReq ptcC2G_EnterSceneReq = new PtcC2G_EnterSceneReq();
				ptcC2G_EnterSceneReq.Data.sceneID = (uint)rowData.SceneID;
				XSingleton<XClientNetwork>.singleton.Send(ptcC2G_EnterSceneReq);
				result = true;
			}
			return result;
		}

		// Token: 0x0600F357 RID: 62295 RVA: 0x00364728 File Offset: 0x00362928
		public void DoCountDown(object obj)
		{
			TeamTowerData singleTowerData = this._doc.SingleTowerData;
			this._time_left = (float)singleTowerData.sweeplefttime - (Time.time - singleTowerData.sweepreqtime);
			bool flag = this._count_timer > 0U;
			if (flag)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(this._count_timer);
			}
			bool flag2 = this._time_left <= 0f;
			if (flag2)
			{
				this._time_left = 0f;
				this._in_sweeping = false;
				this._sweep_finished = true;
				this.SetTimeLeft(0);
				this.OnCloseSweep(null);
				this._doc.GetSingleTowerActivityTop();
			}
			else
			{
				this.SetTimeLeft((int)this._time_left);
				this._count_timer = XSingleton<XTimerMgr>.singleton.SetTimer(1f, new XTimerMgr.ElapsedEventHandler(this.DoCountDown), null);
			}
		}

		// Token: 0x0600F358 RID: 62296 RVA: 0x003647FC File Offset: 0x003629FC
		private void InitTowerMap(int curfloor = 1)
		{
			TeamTowerRewardTable.RowData[] teamTowerTable = this._doc.GetTeamTowerTable();
			this._tower_max_floor = teamTowerTable.Length;
			int num = this._doc.SingleTowerData.maxlevel;
			num = ((num + 5 >= this._tower_max_floor) ? this._tower_max_floor : (num + 5));
			num = ((num % 2 == 0) ? num : (num + 1));
			int num2 = num / 2 - 1;
			IXUILabel ixuilabel = base.uiBehaviour.transform.Find("Bg/Tower/TowerBase/Floor").GetComponent("XUILabel") as IXUILabel;
			GameObject gameObject = base.uiBehaviour.transform.Find("Bg/Tower/TowerBase/Floor/Current/Normal/UI_hasd_gk").gameObject;
			ixuilabel.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_LEVEL"), 1));
			bool flag = this._doc.SingleTowerData.level + 1 == 1;
			if (flag)
			{
				gameObject.SetActive(true);
			}
			else
			{
				gameObject.SetActive(false);
			}
			ixuilabel = (base.uiBehaviour.transform.Find("Bg/Tower/TowerBase/Floor1").GetComponent("XUILabel") as IXUILabel);
			ixuilabel.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_LEVEL"), 2));
			gameObject = base.uiBehaviour.transform.Find("Bg/Tower/TowerBase/Floor1/Current/Normal/UI_hasd_gk").gameObject;
			bool flag2 = this._doc.SingleTowerData.level + 1 == 2;
			if (flag2)
			{
				gameObject.SetActive(true);
			}
			else
			{
				gameObject.SetActive(false);
			}
			IXUISprite ixuisprite = base.uiBehaviour.transform.Find("Bg/Tower/TowerBase/Floor/FirstBlood").GetComponent("XUISprite") as IXUISprite;
			ixuisprite.SetVisible(false);
			IXUISprite ixuisprite2 = base.uiBehaviour.transform.Find("Bg/Tower/TowerBase/Floor").GetComponent("XUISprite") as IXUISprite;
			TeamTowerRewardTable.RowData rowData = teamTowerTable[0];
			bool flag3 = curfloor >= 1;
			if (flag3)
			{
				ixuisprite2.SetEnabled(false);
			}
			else
			{
				ixuisprite2.SetEnabled(true);
			}
			ixuisprite2 = (base.uiBehaviour.transform.Find("Bg/Tower/TowerBase/Floor1").GetComponent("XUISprite") as IXUISprite);
			ixuisprite = (base.uiBehaviour.transform.Find("Bg/Tower/TowerBase/Floor1/FirstBlood").GetComponent("XUISprite") as IXUISprite);
			ixuisprite.SetVisible(false);
			rowData = teamTowerTable[1];
			bool flag4 = curfloor >= 2;
			if (flag4)
			{
				ixuisprite2.SetEnabled(false);
			}
			else
			{
				ixuisprite2.SetEnabled(true);
			}
			base.uiBehaviour.mTowerPool.ReturnAll(false);
			for (int i = 0; i < num2; i++)
			{
				GameObject gameObject2 = base.uiBehaviour.mTowerPool.FetchGameObject(false);
				Vector3 localPosition = new Vector3(base.uiBehaviour.mTowerPool.TplPos.x, base.uiBehaviour.mTowerPool.TplPos.y + (float)((base.uiBehaviour.mTowerPool.TplHeight - 60) * i), base.uiBehaviour.mTowerPool.TplPos.z);
				gameObject2.transform.localPosition = localPosition;
				rowData = teamTowerTable[(i + 1) * 2];
				ixuilabel = (gameObject2.transform.Find("Floor").GetComponent("XUILabel") as IXUILabel);
				ixuilabel.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_LEVEL"), (i + 1) * 2 + 1));
				ixuisprite2 = (gameObject2.transform.Find("Floor").GetComponent("XUISprite") as IXUISprite);
				ixuisprite = (gameObject2.transform.Find("Floor/FirstBlood").GetComponent("XUISprite") as IXUISprite);
				ixuisprite.SetVisible(false);
				gameObject = gameObject2.transform.Find("Floor/Current/Normal/UI_hasd_gk").gameObject;
				bool flag5 = this._doc.SingleTowerData.level + 1 == (i + 1) * 2 + 1;
				if (flag5)
				{
					gameObject.SetActive(true);
				}
				else
				{
					gameObject.SetActive(false);
				}
				bool flag6 = curfloor >= (i + 1) * 2 + 1;
				if (flag6)
				{
					ixuisprite2.SetEnabled(false);
				}
				else
				{
					ixuisprite2.SetEnabled(true);
				}
				ixuilabel = (gameObject2.transform.Find("Floor1").GetComponent("XUILabel") as IXUILabel);
				ixuilabel.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_LEVEL"), (i + 1) * 2 + 2));
				ixuisprite = (gameObject2.transform.Find("Floor1/FirstBlood").GetComponent("XUISprite") as IXUISprite);
				ixuisprite.SetVisible(false);
				rowData = teamTowerTable[(i + 1) * 2 + 1];
				ixuisprite2 = (gameObject2.transform.Find("Floor1").GetComponent("XUISprite") as IXUISprite);
				bool flag7 = curfloor >= (i + 1) * 2 + 2;
				if (flag7)
				{
					ixuisprite2.SetEnabled(false);
				}
				else
				{
					ixuisprite2.SetEnabled(true);
				}
				gameObject = gameObject2.transform.Find("Floor1/Current/Normal/UI_hasd_gk").gameObject;
				bool flag8 = this._doc.SingleTowerData.level + 1 == (i + 1) * 2 + 2;
				if (flag8)
				{
					gameObject.SetActive(true);
				}
				else
				{
					gameObject.SetActive(false);
				}
			}
			base.uiBehaviour.mScroll.NeedRecalcBounds();
			base.uiBehaviour.mScroll.SetPosition(1f - (float)curfloor * 1f / (float)num);
		}

		// Token: 0x0600F359 RID: 62297 RVA: 0x00364D8C File Offset: 0x00362F8C
		private bool OnGetReward(IXUIButton btn)
		{
			this._doc.GetSweepSingleTowerReward();
			return true;
		}

		// Token: 0x0600F35A RID: 62298 RVA: 0x00364DAB File Offset: 0x00362FAB
		public void OnGotReward()
		{
			base.uiBehaviour.mSweepResult.SetVisible(false);
			this._doc.GetSingleTowerActivityTop();
		}

		// Token: 0x0600F35B RID: 62299 RVA: 0x00364DCC File Offset: 0x00362FCC
		public void OnShowSweepResultFrame()
		{
			base.uiBehaviour.mSweepResult.SetVisible(true);
			base.uiBehaviour.mRewardFx.SetVisible(false);
			base.uiBehaviour.mEffect.SetActive(false);
			this.OnRefreshResult();
		}

		// Token: 0x0600F35C RID: 62300 RVA: 0x00364E0C File Offset: 0x0036300C
		public void OnHideSweepResultFrame()
		{
			base.uiBehaviour.mSweepResult.SetVisible(false);
		}

		// Token: 0x0600F35D RID: 62301 RVA: 0x00364E24 File Offset: 0x00363024
		private bool OnRefreshReward(IXUIButton btn)
		{
			base.uiBehaviour.mRewardRefresh.SetEnable(false, false);
			base.uiBehaviour.mRewardGet.SetEnable(false, false);
			this._doc.RefreshSingleSweepReward();
			return true;
		}

		// Token: 0x0600F35E RID: 62302 RVA: 0x00364E6C File Offset: 0x0036306C
		public void OnStartPlayRefreshResultEffect(ErrorCode code, int res)
		{
			bool flag = code > ErrorCode.ERR_SUCCESS;
			if (flag)
			{
				base.uiBehaviour.mRewardRefresh.SetEnable(true, false);
				base.uiBehaviour.mRewardGet.SetEnable(true, false);
			}
			else
			{
				this._effect_result = (float)res / 100f;
				this._doc.SingleTowerData.refreshcount++;
				bool flag2 = this._doc.SingleTowerData.refreshcount >= this._refresh_cost.Count;
				if (flag2)
				{
					this._doc.SingleTowerData.refreshcount = this._refresh_cost.Count;
				}
				base.uiBehaviour.mRewardFx.SetVisible(true);
				base.uiBehaviour.mEffect.SetActive(false);
				base.uiBehaviour.mRewardFreeTime.SetText(string.Format("{0}/{1}", this._refresh_cost.Count - this._doc.SingleTowerData.refreshcount, this._refresh_cost.Count));
				int index = (this._doc.SingleTowerData.refreshcount >= this._refresh_cost.Count) ? (this._refresh_cost.Count - 1) : this._doc.SingleTowerData.refreshcount;
				bool flag3 = this._refresh_cost[index] == 0;
				if (flag3)
				{
					base.uiBehaviour.mRewardFreeLabel.SetVisible(true);
					base.uiBehaviour.mRewardMoneyNum.SetVisible(false);
				}
				else
				{
					base.uiBehaviour.mRewardFreeLabel.SetVisible(false);
					base.uiBehaviour.mRewardMoneyNum.SetVisible(true);
					base.uiBehaviour.mRewardMoneyNum.SetText(this._refresh_cost[index].ToString());
					string itemSmallIcon = XBagDocument.GetItemSmallIcon(this._refresh_money[index], 0U);
					base.uiBehaviour.mRewardMoneySign.SetSprite(itemSmallIcon);
				}
				this.state = ActivityTeamTowerSingleDlg.State.BEGIN;
				this.timePass.LeftTime = 10f;
			}
		}

		// Token: 0x0600F35F RID: 62303 RVA: 0x00365088 File Offset: 0x00363288
		private int GetFrame(uint index)
		{
			bool flag = this.frames.Count <= 0;
			int result;
			if (flag)
			{
				result = 15;
			}
			else
			{
				bool flag2 = (long)this.frames.Count <= (long)((ulong)index);
				if (flag2)
				{
					result = this.frames[this.frames.Count - 1];
				}
				else
				{
					result = this.frames[(int)index];
				}
			}
			return result;
		}

		// Token: 0x0600F360 RID: 62304 RVA: 0x003650F5 File Offset: 0x003632F5
		public void OnRefreshReverseCount()
		{
			this.OnRefreshSweepInfo();
		}

		// Token: 0x0600F361 RID: 62305 RVA: 0x00365100 File Offset: 0x00363300
		public void RefreshAlpha()
		{
			int num = XSingleton<XCommon>.singleton.RandomInt(0, this._random_list.Count);
			float num2 = this._random_list[num];
			base.uiBehaviour.mRewardAlpha.SetText(string.Format("{0:F1}{1}", num2, XSingleton<XStringTable>.singleton.GetString("FOLD")));
			base.uiBehaviour.mRewardAlpha.SetColor(XSingleton<UiUtility>.singleton.GetItemQualityColor(num));
		}

		// Token: 0x0600F362 RID: 62306 RVA: 0x00365180 File Offset: 0x00363380
		private void PlayAlphaFinished()
		{
			base.uiBehaviour.mRewardAlpha.SetText(string.Format("{0:F1}{1}", this._effect_result, XSingleton<XStringTable>.singleton.GetString("FOLD")));
			for (int i = 0; i < this._random_list.Count; i++)
			{
				bool flag = this._random_list[i] == this._effect_result;
				if (flag)
				{
					base.uiBehaviour.mRewardAlpha.SetColor(XSingleton<UiUtility>.singleton.GetItemQualityColor(i));
				}
			}
			base.uiBehaviour.mRewardFx.SetVisible(false);
			this.OnInitReward(base.uiBehaviour.mRewardFramePool, this._effect_result);
			base.uiBehaviour.mRewardRefresh.SetEnable(true, false);
			base.uiBehaviour.mRewardGet.SetEnable(true, false);
			base.uiBehaviour.mEffect.SetActive(true);
		}

		// Token: 0x0600F363 RID: 62307 RVA: 0x00365278 File Offset: 0x00363478
		public void OnRefreshResult()
		{
			TeamTowerData singleTowerData = this._doc.SingleTowerData;
			base.uiBehaviour.mRewardLevel.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("TEAMTOWER_REACH_LEVEL"), (singleTowerData.maxlevel == 0) ? 1 : singleTowerData.maxlevel));
			base.uiBehaviour.mRewardAlpha.SetText(string.Format("{0:F1}{1}", 1, XSingleton<XStringTable>.singleton.GetString("FOLD")));
			base.uiBehaviour.mRewardAlpha.SetColor(XSingleton<UiUtility>.singleton.GetItemQualityColor(0));
			base.uiBehaviour.mRewardFreeTime.SetText(string.Format("{0}/{1}", this._refresh_cost.Count - this._doc.SingleTowerData.refreshcount, this._refresh_cost.Count));
			int index = (this._doc.SingleTowerData.refreshcount >= this._refresh_cost.Count) ? (this._refresh_cost.Count - 1) : this._doc.SingleTowerData.refreshcount;
			bool flag = this._refresh_cost[index] == 0;
			if (flag)
			{
				base.uiBehaviour.mRewardFreeLabel.SetVisible(true);
				base.uiBehaviour.mRewardMoneyNum.SetVisible(false);
			}
			else
			{
				base.uiBehaviour.mRewardFreeLabel.SetVisible(false);
				base.uiBehaviour.mRewardMoneyNum.SetVisible(true);
				base.uiBehaviour.mRewardMoneyNum.SetText(this._refresh_cost[index].ToString());
				string itemSmallIcon = XBagDocument.GetItemSmallIcon(this._refresh_money[index], 0U);
				base.uiBehaviour.mRewardMoneySign.SetSprite(itemSmallIcon);
			}
			this.OnInitReward(base.uiBehaviour.mRewardFramePool, 1f);
		}

		// Token: 0x0600F364 RID: 62308 RVA: 0x00365468 File Offset: 0x00363668
		public override void OnUpdate()
		{
			bool flag = this.state == ActivityTeamTowerSingleDlg.State.BEGIN;
			if (flag)
			{
				this._play_count = 0;
				this._acc_time = 0;
				this.timePass.LeftTime = 10f;
				this.state = ActivityTeamTowerSingleDlg.State.PLAY;
			}
			else
			{
				bool flag2 = this.state == ActivityTeamTowerSingleDlg.State.PLAY;
				if (flag2)
				{
					this.timePass.Update();
					this._acc_time = (int)(this.timePass.PassTime * 1000f);
					bool flag3 = this._acc_time > this.GetFrame((uint)this._play_count);
					if (flag3)
					{
						this.timePass.LeftTime = 1f;
						this._acc_time = 0;
						this._play_count++;
						this.RefreshAlpha();
						bool flag4 = this._play_count >= this._all_count;
						if (flag4)
						{
							this._play_count = 0;
							this.state = ActivityTeamTowerSingleDlg.State.Idle;
						}
					}
				}
				else
				{
					bool flag5 = this.state == ActivityTeamTowerSingleDlg.State.Idle;
					if (flag5)
					{
						this.state = ActivityTeamTowerSingleDlg.State.None;
						this.PlayAlphaFinished();
					}
				}
			}
		}

		// Token: 0x04006874 RID: 26740
		private XExpeditionDocument _doc;

		// Token: 0x04006875 RID: 26741
		private uint _count_timer;

		// Token: 0x04006876 RID: 26742
		private bool _in_sweeping = false;

		// Token: 0x04006877 RID: 26743
		private float _time_left = 0f;

		// Token: 0x04006878 RID: 26744
		private bool _sweep_finished = false;

		// Token: 0x04006879 RID: 26745
		private float _sweep_time = 0f;

		// Token: 0x0400687A RID: 26746
		private int _sweep_level = 0;

		// Token: 0x0400687B RID: 26747
		private int _tower_max_floor = 100;

		// Token: 0x0400687C RID: 26748
		private uint _show_sweep_timer = 0U;

		// Token: 0x0400687D RID: 26749
		private float _effect_result = 1f;

		// Token: 0x0400687E RID: 26750
		private List<float> _random_list = new List<float>();

		// Token: 0x0400687F RID: 26751
		private List<int> _refresh_cost = new List<int>();

		// Token: 0x04006880 RID: 26752
		private List<int> _refresh_money = new List<int>();

		// Token: 0x04006881 RID: 26753
		private List<int> frames = new List<int>();

		// Token: 0x04006882 RID: 26754
		private XElapseTimer timePass = new XElapseTimer();

		// Token: 0x04006883 RID: 26755
		public ActivityTeamTowerSingleDlg.State state = ActivityTeamTowerSingleDlg.State.None;

		// Token: 0x04006884 RID: 26756
		private int _play_count = 0;

		// Token: 0x04006885 RID: 26757
		private int _acc_time = 0;

		// Token: 0x04006886 RID: 26758
		private int _all_count = 35;

		// Token: 0x04006887 RID: 26759
		private bool _is_getting_reward = false;

		// Token: 0x02001A04 RID: 6660
		public enum State
		{
			// Token: 0x040081FF RID: 33279
			BEGIN,
			// Token: 0x04008200 RID: 33280
			PLAY,
			// Token: 0x04008201 RID: 33281
			Idle,
			// Token: 0x04008202 RID: 33282
			FADE,
			// Token: 0x04008203 RID: 33283
			None
		}
	}
}
